﻿<!DOCTYPE html>
<!--总体评估模板管理编辑-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>
<body>
    <div id="app" v-cloak class="popupW100">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="150px" size="mini" label-position="right">
            <el-row>
                <el-col class="head-tool">
                    <el-button type="primary" @click="UserInput('tj')">{{col.btnAdd}}</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.OverallAssessmentTypeName" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{OverallAssessmentType.OverallAssessmentTypeName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="24" >
                    <el-form-item label="考核内容及评分： ">
                    </el-form-item>
                </el-col>
                <el-col span="24" >
                    <el-table stripe :data="Form.CheckProjectList"
                              border
                              style="width:100%">
                        <el-table-column prop="CheckProject"
                                         :label="OverallAssessmentType.CheckProject">
                        </el-table-column>
                        <el-table-column prop="TheWeight"
                                         :label="OverallAssessmentType.TheWeight">
                        </el-table-column>

                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, Form.CheckProjectList)"
                                           type="text"
                                           size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end" style="margin-top:10px">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="onBack">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog title="总体评估考核项管理" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%" top="0vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:280px;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">

        var app = new Vue({
            el: '#app',
            data: {
                id: '',
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    OverallAssessmentTypeName: '',//姓名
                    CheckProjectList: [],//选项
                },
                ListItem: ListItem,
                //表单验证
                rules: {
                    OverallAssessmentTypeName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(2, 500), message: verification.StringLengthAtoB.m.format(2, 500), trigger: 'blur' }
                    ]
                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleChange: function (value) {
                    console.log(value);
                },
                deleteRow: function (index, rows) {
                    rows.splice(index, 1);
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/OverallAssessmentType/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                onBack: function () {
                    parent.app.ListItem.dialogVisible = false;
                },
                getData: function () {
                    getData(this, '/api/OverallAssessmentType/get?id=' + this.id);
                },
                UserInput: function (val, id) { DialogShow(this, val, "OverallEvaluationTemplateManagementCheckItemInput.html", id); },
            },
            mounted: function () {

                this.id = getUrlParam("id");
                this.getData();
            }
        });
    </script>
</body>

</html>